//////////////////////////////////////////////////////////////////////////
//
// GAM203
// Mesh Dwarf
// MeshDwarf.h
// 
// Grant Johnson
// Qantm College
// 27/10/2010
//
//////////////////////////////////////////////////////////////////////////

#ifndef MESHDWARF_H
#define MESHDWARF_H

#include "Drawable.h"

#include <d3d9.h>
#include <d3d9types.h>

#include <vector>

class MeshDwarf : public Drawable
{
public:
	MeshDwarf();
	virtual ~MeshDwarf();

	//////////////////////////////////////////////////////////////////////////
	// VIRTUAL - Inherited from Drawable
	// For creating the drawable object
	//
	// Paramaters:
	// a_pDevice, the direct3d device
	// a_pTexFileName, a path passed into the function. This can either be used for
	// the texture file name, or for a mesh's file name.
	//
	// Returns false if any step of the creation failed
	// Returns true if created successfully
	//
	//////////////////////////////////////////////////////////////////////////
	virtual bool CreateObject(IDirect3DDevice9* a_pDevice, char* a_pTexFileName);

	//////////////////////////////////////////////////////////////////////////
	// VIRTUAL - Inherited from Drawable
	// For rendering the drawable object
	//
	// Paramaters:
	// a_pDevice, the direct3d device
	//
	// Returns void
	//
	//////////////////////////////////////////////////////////////////////////
	virtual void Render(float a_dt, IDirect3DDevice9* a_pDevice);

private:
	//Mesh used by the drawable object
	ID3DXMesh* m_pMesh;
	
	//Number of segments in the mesh
	DWORD m_segmentCount;

	// List of materials on mesh (pairs of material structs with a single texture ptr each)
	typedef std::pair<D3DMATERIAL9, IDirect3DTexture9*> MaterialTexturePair;
	typedef std::vector<MaterialTexturePair> MaterialList;
	MaterialList m_materials;
};

#endif  //MESHDWARF_H
